package com.lam.dormitory.common.config;

import com.alibaba.excel.EasyExcel;
import com.lam.dormitory.common.easyExcel.DormitoryServiceVoListener;
import com.lam.dormitory.service.IDormitoryServiceService;
import com.lam.dormitory.vo.DormitoryServiceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * EasyExcel 配置
 */
@Configuration
public class EasyExcelConfig {
    @Autowired
    private IDormitoryServiceService dormitoryServiceService;
    //文件路径
    @Value("${easyexcel.path}")
    private String path;

//    @Scheduled(fixedDelay = 3000)
//    @Scheduled(cron = "0 0 0 1* ?")
    public void scheduledTask() {
        EasyExcel.read(path, DormitoryServiceVo.class, new DormitoryServiceVoListener(dormitoryServiceService)).sheet().doRead();
    }
}
